package com.deep.spring.v6;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/weather")
public class WeatherController {
    @Autowired
    private WeatherDataService weatherDataService;

    @GetMapping("/cityId/{cityId}")
    @ResponseBody
    public WeatherResponse getDataByCityId(@PathVariable("cityId") String cityId) {

        return weatherDataService.getDataByCityId(cityId);
    }

    @GetMapping("/cityName/{cityName}")
    @ResponseBody
    public WeatherResponse getDataByCityName(@PathVariable("cityName") String cityName) {

        return weatherDataService.getDataByCityName(cityName);
    }
}
